1. Field of the Invention
The present invention relates to a method and apparatus for compression of a digital audio signal, and in particular to a method and apparatus for compression of a digital audio signal using either a compressed digital sample of the signal or a compressed digital representation of the change of the sample relative to the previous sample, depending on which more closely approximates the uncompressed data sample.
2. Description of the Related Art
Information processing systems often need to both store large amounts of digital data in a mass or dynamic memory device and to transfer a large segment of information in a minimum of time. Several approaches have been developed to meet this need. One such approach is data compression, in which a given segment of digital information is encoded such that it occupies less space in memory. Data compression techniques may be classified as either lossless or lossy processes. Lossless processes are those in which the compressed data may be regenerated exactly as it existed prior to compression, i.e., no data is lost. Such processes are useful for compression of program instructions and textual data, where the entire information content of the data must be preserved. Lossy processes are those in which a certain portion of the perceptibly insignificant input information is irreversibly lost during data compression.
One area where lossy compression processes have proven most valuable is in the storage of audio data for software applications. One reason is that audio data generally requires allocation of a large amount of memory. Thus, in addition to the space taken up on the storage media, it takes a relatively long time to load the data from storage, and, once loaded, the data takes up a lot of space in random access memory where storage space is at a premium. Another reason is that the sound reproduction from compressed audio data can be relatively good without having to preserve the entire information content of the original audio signal. With the current popularity of software applications such as video games, there is presently an industry wide desire to provide an even greater compression ratio of audio data, while at the same time preserving as much of the original signal quality upon regeneration as possible. Moreover, there is a desire to provide a compression and regeneration scheme which may be implemented with a minimum of software programming steps and/or hardware.
One commonly used form of compression of audio signals involves storing "delta" values, rather than absolute values, for each sample. That is, instead of storing the exact value of each sample, only the difference between the current value and the previous value is stored. Since audio signals usually vary slowly, delta values tend to be much smaller than the full absolute sample values and thus can be stored in fewer bits.
The process of looping is another attempt to minimize the amount of data necessary to represent information such as an audio signal. In looping, when a particular segment of an audio signal is to be played repeatedly in succession for an extended period of time, the audio data for the segment may be stored once and the control program merely loops back to the beginning of the segment each time through the loop. However, systems using compressed delta values for looping are particularly susceptible to signal amplitude drift each time through the loop, such that audio quality of the looped signal gradually deteriorates until noticeable distortion occurs. Signal amplitude drift occurs using delta values because, the first time through the loop, the encoded value of starting point would be determined by the sample immediately preceding the loop. However, after the first time through the loop, the encoded value of the starting point would be determined by the last sample in the loop. This dissimilarity in the samples used to determine the starting point generally results in a variance of the starting point each time through the loop, thereby causing the drift. Thus, in addition to maximizing the compression ratio and preserving sound quality, there is a need for a system which can provide compressed audio data which may be looped without signal amplitude drift.